home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
001-100
/
001-025
/
008
/
src
/
hack.track.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-17
|
619b
|
38 lines
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
#include "hack.h"
#ifdef TRACK
#define UTSZ 50
coord utrack[UTSZ];
int utcnt = 0;
int utpnt = 0;
initrack(){
utcnt = utpnt = 0;
}
/* add to track */
settrack(){
if(utcnt < UTSZ) utcnt++;
if(utpnt == UTSZ) utpnt = 0;
utrack[utpnt].x = u.ux;
utrack[utpnt].y = u.uy;
utpnt++;
}
coord *
gettrack(x,y) register int x,y; {
register int i,cnt;
coord tc;
cnt = utcnt;
for(i = utpnt-1; cnt--; i--){
if(i == -1) i = UTSZ-1;
tc = utrack[i];
if((x-tc.x)*(x-tc.x) + (y-tc.y)*(y-tc.y) < 3)
return(&(utrack[i]));
}
return(0);
}
#endif TRACK